package 机试题16年;

import java.util.Scanner;

/**
 * Created by hest0 on 2017/4/18.
 */
public class 最大间隔 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = sc.nextInt();
            }
            System.out.println(func(n, a));
        }
        sc.close();
    }

    private static int func(int n, int[] a) {
        int max1 = Integer.MIN_VALUE;
        int min2 = Integer.MAX_VALUE;
        for (int i = 1; i < n - 1; i++) {
            max1 = (a[i] - a[i - 1] > max1) ? a[i] - a[i - 1] : max1;
            min2 = (a[i + 1] - a[i - 1] < min2) ? a[i + 1] - a[i - 1] : min2;
        }
        max1 = (a[n - 1] - a[n - 2] > max1) ? a[n - 1] - a[n - 2] : max1;
        return max1 > min2 ? max1 : min2;
    }


}
